﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UITournament.FactoryMethod;

namespace UITournament
{
    class Program
    {
        static void Main(string[] args)
        {
            Trainer ivan = new Trainer("Ivan", "Ivanov");
            Team lokoSF = new Team("Lokomotiv", "Sofia");
            ivan.Team = lokoSF;
            Console.WriteLine(ivan);

            Athlete sergo = new Athlete("Sergo", "Lilov", Gender.Male);
            Console.WriteLine(sergo);
            sergo.UniqueNumber = 555;
            sergo.DateOfBirth = DateTime.Parse("1990 12 11");
            sergo.Trainer = ivan;
            Console.WriteLine(sergo);

            string[] arr = new string[100];
            for (int i = 0; i < arr.Length - 2; i++)
            {
                arr[i] = "dfdsdkfmsklj" + i;
            }

            var factoryAthlete = new MakeAthlete();
            var factoryTrainer = new MakeTrainer();

            var createFactoryTrainer = factoryTrainer.MakePerson();
            var createFactoryAthlete = factoryAthlete.MakePerson();


            arr[98] = createFactoryAthlete.ToString();
            arr[99] = createFactoryTrainer.ToString();


            //SaveReadToFile.Serialize(arr);

            //arr = (string[])SaveReadToFile.Deserialize(arr);

            for (int i = 0; i < arr.Length; i++)
            {
                Console.WriteLine(arr[i]);
            }

            // Test ageCounter method
            string testForAge = Common.GetAge(sergo, new Tournament("UEFA", "sf", new DateTime(2013, 12, 01), new DateTime(2015, 12, 10)));
            Console.Write(string.Format("{0} {1} {2} year \n", sergo.FirstName, sergo.LastName, testForAge));
        }
    }
}
